package com.tencent.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @BelongsProject: health2.2
 * @BelongsPackage: com.tencent.entity
 * @ClassName: Result
 * @Description: TODO
 * @Version: 1.0.0
 * @CreateTime: 2022-08-30  10:54
 * @Author: Yangjx
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {

    public static final Integer SUCCESS = 1000;
    public static final Integer NO_LOGIN = 2000;
    public static final Integer NO_AUTH = 3000;
    public static final Integer REGISTER_QUESTION = 10086;

    private Object data;

//    private String refresh_token; //过期

    //状态码:成功访问到数据，未登录，没有权限,...
    private  Integer code;

    private String msg;


    public Result(boolean data, String getSetmealListSuccess) {
    }

    /**
     *  成功返回的数据
     * @param data
     * @return
     */
    public static Result success(Object data){
        Result result = new Result();
        result.setCode(SUCCESS);
        result.setData(data);
        return  result;
    }

    /**
     * 没有登录返回的数据
     * @param msg
     * @return
     */
    public static Result noLogin(String msg){
        Result result = new Result();
        result.setCode(NO_LOGIN);
        result.setMsg(msg);

        return result;
    }

    /**
     * 没有权限返回的数据
     * @param msg
     * @return
     */
    public static Result noAuth(String msg){
        Result result = new Result();
        result.setCode(NO_AUTH);
        result.setMsg(msg);

        return result;
    }

    /**
     * @Description: TODO 注册失败问题
     * @author Yangjx
     * @date 2022/9/3 9:48
     * @param msg
     * @return Result
     */
    public static Result registerQuestion(String msg){
        Result result = new Result();
        result.setCode(REGISTER_QUESTION);
        result.setMsg(msg);
        return result;
    }
}

